#ifndef _SHADER_MANAGER
#define _SHADER_MANAGER

#include <d3d10.h>
#include <d3dx10.h>
#include <Windows.h>
#include <map>
#include <string>

///A helper class for managing a shader, techniques and variables
class ShaderManager
{
private:
	ID3D10Device * m_pd3dDevice;
	ID3D10Effect * m_pd3dEffect;



	std::map<std::string, ID3D10EffectTechnique*> m_Techniques;
	
	std::map<std::string, ID3D10EffectScalarVariable*>		m_ScalarVariables;
	std::map<std::string, ID3D10EffectVectorVariable*>		m_VectorVariables;
	std::map<std::string, ID3D10EffectMatrixVariable*>		m_MatrixVariables;
	std::map<std::string, ID3D10EffectShaderResourceVariable*> m_ResourceVariables;
	
public:


	ShaderManager(ID3D10Device * device, std::string shaderFilePath);
	~ShaderManager();

	///adding variables to containers
	void addScalarVariable(std::string name);
	void addVectorVariable(std::string name);
	void addMatrixVariable(std::string name);
	void addResourceVariable(std::string name );

	///getting variables
	ID3D10EffectScalarVariable * getScalarVariableByName(std::string name);
	ID3D10EffectVectorVariable * getVectorVariableByName(std::string name);
	ID3D10EffectMatrixVariable * getMatrixVariableByName(std::string name);
	ID3D10EffectShaderResourceVariable * getResourceVariableByName(std::string name);

	///setting variables
	void setScalarVariable(std::string name, float value);
	void setVectorVariable(std::string name, float* value);
	void setMatrixVariable(std::string name, float* value);
	void setResourceVariable(std::string name, ID3D10ShaderResourceView*   value);

	///manage techniques
	void addTechnique(std::string name);
	ID3D10EffectTechnique* getTechniqueByName(std::string name);

};


#endif